package com.zbf.task.taskweb;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 作者: LCG
 * 日期: 2019/8/16 10:10
 * 描述:@DisallowConcurrentExecution 禁止并发执行多个相同定义的JobDetail,
 * 这个注解是加在Job类上的, 但意思并不是不能同时执行多个Job,
 * 而是不能并发执行同一个Job Definition(由JobDetail定义), 但是可以同时执行多个不同的JobDetail,
 */
@DisallowConcurrentExecution
public class HelloJob2 implements Job {

    private static Logger logger=LoggerFactory.getLogger(HelloJob2.class);

    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String s = jobExecutionContext.getJobDetail().getKey().getName();
        logger.info("===========小新==========="+s);
        System.out.println("===========小新==========="+s);
    }


}
